<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace teamug;

class Language {
  
  private $phrases;
  
  public function __construct($phrases) {
    $this->phrases = $phrases;
  }
  
  public function addPhrases($phrases) {
    $this->phrases = \array_merge($this->phrases, $phrases);
  }
  
  public function __get($name) {
    return \array_key_exists($name, $this->phrases) ? $this->phrases[$name] : null;
  }

  public function getPrefix($name, $prefix) {
    if (\array_key_exists($prefix.$name, $this->phrases)) {
      return $this->phrases[$prefix.$name];
    } elseif (\array_key_exists($name, $this->phrases)) {
      return $this->phrases[$name];
    } else {
      return null;
    }
  }
  
  public function getPostfix($name, $postfix) {
    if (\array_key_exists($name.$postfix, $this->phrases)) {
      return $this->phrases[$name.$postfix];
    } elseif (\array_key_exists($name, $this->phrases)) {
      return $this->phrases[$name];
    } else {
      return null;
    }
  }
  
  
  
  
  
  
  
  
  
}